/** * @license * Copyright (c) 2014, 2018, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ "use strict";define(["require","ojL10n!ojtranslations/nls/ojtranslations","promise"],function(e,t,n){n.polyfill();var o={};"undefined"!=typeof window?o=window:"undefined"!=typeof self&&(o=self);var r=o.oj,s=o.oj={version:"5.2.0",revision:"2018-08-09_18-00-40",noConflict:function(){o.oj=r}};s.Logger={},s.Logger.LEVEL_NONE=0,s.Logger.LEVEL_ERROR=1,s.Logger.LEVEL_WARN=2,s.Logger.LEVEL_INFO=3,s.Logger.LEVEL_LOG=4,s.Logger._METHOD_ERROR="error",s.Logger._METHOD_WARN="warn",s.Logger._METHOD_INFO="info",s.Logger._METHOD_LOG="log",s.Logger._defaultOptions={level:s.Logger.LEVEL_ERROR,writer:null},s.Logger._options=s.Logger._defaultOptions,s.Logger.error=function(e){s.Logger._write(s.Logger.LEVEL_ERROR,s.Logger._METHOD_ERROR,arguments)},s.Logger.info=function(e){s.Logger._write(s.Logger.LEVEL_INFO,s.Logger._METHOD_INFO,arguments)},s.Logger.warn=function(e){s.Logger._write(s.Logger.LEVEL_WARN,s.Logger._METHOD_WARN,arguments)},s.Logger.log=function(e){s.Logger._write(s.Logger.LEVEL_LOG,s.Logger._METHOD_LOG,arguments)},s.Logger.option=function(e,t){var n,o={};if(0==arguments.length){for(n in s.Logger._options)s.Logger._options.hasOwnProperty(n)&&(o[n]=s.Logger._options[n]);return o}if("string"==typeof e&&void 0===t)return void 0===s.Logger._options[e]?null:s.Logger._options[e];if("string"==typeof e)s.Logger._options[e]=t;else{var r=e;for(n in r)r.hasOwnProperty(n)&&s.Logger.option(n,r[n])}},s.Logger._write=function(e,t,n){if(!(s.Logger.option("level")2){for(o+="(",n=2;n0,"empty string"))},s.Assert.assertString=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"string",t,1,!1)},s.Assert.assertStringOrNull=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"string",t,1,!0)},s.Assert.assertFunction=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"function",t,1,!1)},s.Assert.assertFunctionOrNull=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"function",t,1,!0)},s.Assert.assertBoolean=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"boolean",t,1,!1)},s.Assert.assertNumber=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"number",t,1,!1)},s.Assert.assertNumberOrNull=function(e,t){s.Assert.DEBUG&&s.Assert.assertType(e,"number",t,1,!0)},s.Assert.assertArray=function(e,t){s.Assert.DEBUG&&(Array.isArray(e)||(void 0===t&&(t=e+" is not an array"),s.Assert.assertionFailed(t,1)))},s.Assert.assertArrayOrNull=function(e,t){s.Assert.DEBUG&&null!=e&&(Array.isArray(e)||(void 0===t&&(t=e+" is not an array"),s.Assert.assertionFailed(t,1)))},s.Assert.assertNonNumeric=function(e,t){s.Assert.DEBUG&&(isNaN(e)||(void 0===t&&(t=e+" is convertible to a number"),s.Assert.assertionFailed(t,1)))},s.Assert.assertNumeric=function(e,t){s.Assert.DEBUG&&isNaN(e)&&(void 0===t&&(t=e+" is not convertible to a number"),s.Assert.assertionFailed(t,1))},s.Assert.assertInSet=function(e,t,n){var o,r;if(null==e||void 0===t[e.toString()]){if(void 0===n){for(r in o=" is not in set: {",t)t.hasOwnProperty(r)&&(o+=r,o+=",");n=e+(o+="}")}s.Assert.assertionFailed(n,1)}},s.Assert.assertionFailed=function(e,t,n){t||(t=0);var o="Assertion";throw n&&(o+=" ("+n+")"),o+=" failed: ",void 0!==e&&(o+=e),new Error(o)};var a,l=o.__oj_Assert_DEBUG;function u(){}return void 0!==l&&(s.Assert.DEBUG=l),s.EventSource=function(){this.Init()},s.Object.createSubclass(s.EventSource,s.Object,"oj.EventSource"),s.EventSource.prototype.Init=function(){this._eventHandlers=[],s.EventSource.superclass.Init.call(this)},s.EventSource.prototype.on=function(e,t){var n,o=!1;for(n=0;n=0;n--)if(this._eventHandlers[n].eventType==e&&this._eventHandlers[n].eventHandlerFunc==t){this._eventHandlers.splice(n,1);break}},s.EventSource.prototype.handleEvent=function(e,t){var n;for(n=0;n-1||e.indexOf("ipad")>-1?o=s.AgentUtils.OS.IOS:e.indexOf("mac")>-1?o=s.AgentUtils.OS.MAC:e.indexOf("sunos")>-1?o=s.AgentUtils.OS.SOLARIS:e.indexOf("android")>-1?o=s.AgentUtils.OS.ANDROID:e.indexOf("linux")>-1?o=s.AgentUtils.OS.LINUX:e.indexOf("windows phone")>-1?o=s.AgentUtils.OS.WINDOWSPHONE:e.indexOf("win")>-1&&(o=s.AgentUtils.OS.WINDOWS),o==s.AgentUtils.OS.ANDROID?a=e.indexOf("mobile")>-1?s.AgentUtils.DEVICETYPE.PHONE:s.AgentUtils.DEVICETYPE.TABLET:o==s.AgentUtils.OS.IOS&&(a=e.indexOf("iphone")>-1?s.AgentUtils.DEVICETYPE.PHONE:s.AgentUtils.DEVICETYPE.TABLET),e.indexOf("msie")>-1?(r=s.AgentUtils.BROWSER.IE,i=s.AgentUtils._parseFloatVersion(e,/msie (\d+[.]\d+)/),e.indexOf("trident")&&(l=s.AgentUtils.ENGINE.TRIDENT,u=s.AgentUtils._parseFloatVersion(e,/trident\/(\d+[.]\d+)/))):e.indexOf("trident")>-1?(r=s.AgentUtils.BROWSER.IE,i=s.AgentUtils._parseFloatVersion(e,/rv:(\d+[.]\d+)/),e.indexOf("trident")&&(l=s.AgentUtils.ENGINE.TRIDENT,u=s.AgentUtils._parseFloatVersion(e,/trident\/(\d+[.]\d+)/))):e.indexOf("edge")>-1?(r=s.AgentUtils.BROWSER.EDGE,i=u=s.AgentUtils._parseFloatVersion(e,/edge\/(\d+[.]\d+)/),l=s.AgentUtils.ENGINE.EDGE_HTML):e.indexOf("chrome")>-1?(r=s.AgentUtils.BROWSER.CHROME,(i=s.AgentUtils._parseFloatVersion(e,/chrome\/(\d+[.]\d+)/))>=28?(l=s.AgentUtils.ENGINE.BLINK,u=i):(l=s.AgentUtils.ENGINE.WEBKIT,u=s.AgentUtils._parseFloatVersion(e,/applewebkit\/(\d+[.]\d+)/))):e.indexOf("safari")>-1?(r=s.AgentUtils.BROWSER.SAFARI,i=s.AgentUtils._parseFloatVersion(e,/version\/(\d+[.]\d+)/),l=s.AgentUtils.ENGINE.WEBKIT,u=s.AgentUtils._parseFloatVersion(e,/applewebkit\/(\d+[.]\d+)/)):e.indexOf("firefox")>-1&&(r=s.AgentUtils.BROWSER.FIREFOX,i=s.AgentUtils._parseFloatVersion(e,/rv:(\d+[.]\d+)/),l=s.AgentUtils.ENGINE.GECKO,u=s.AgentUtils._parseFloatVersion(e,/gecko\/(\d+)/)),{os:(n=s.AgentUtils._currAgentInfo={hashCode:t,os:o,browser:r,browserVersion:i,deviceType:a,engine:l,engineVersion:u}).os,browser:n.browser,browserVersion:n.browserVersion,deviceType:n.deviceType,engine:n.engine,engineVersion:n.engineVersion,hashCode:n.hashCode}},s.AgentUtils._parseFloatVersion=function(e,t){var n=e.match(t);if(n){var o=n[1];if(o)return parseFloat(o)}return 0},s.ThemeUtils=function(){},s.ThemeUtils.getThemeName=function(){return(s.ThemeUtils.parseJSONFromFontFamily("oj-theme-json")||{}).name},s.ThemeUtils.getThemeTargetPlatform=function(){return(s.ThemeUtils.parseJSONFromFontFamily("oj-theme-json")||{}).targetPlatform},s.ThemeUtils.clearCache=function(){this._cache=null},s.ThemeUtils.parseJSONFromFontFamily=function(e){null==this._cache&&(this._cache={},this._null_cache_value={},this._headfontstring=window.getComputedStyle(document.head).getPropertyValue("font-family"));var t=this._cache[e];if(t===this._null_cache_value)return null;if(null!=t)return t;var n=document.createElement("meta");n.className=e,document.head.appendChild(n);var o=window.getComputedStyle(n).getPropertyValue("font-family");if(null!=o)if(o==this._headfontstring)s.Logger.warn("parseJSONFromFontFamily: When the selector ",e," is applied the font-family read off the dom element is ",o,". The parent dom elment has the same font-family value."," This is interpreted to mean that no value was sent down for selector ",e,". Null will be returned.");else{var r=o.replace(/^['"]+|\s+|\\|(;\s?})+|['"]$/g,"");if(r)try{t=JSON.parse(r)}catch(o){var i=r.indexOf(","),a=!1;if(i>-1){r=r.substring(i+2);try{t=JSON.parse(r),a=!0}catch(e){}}if(0==a)throw s.Logger.error("Error parsing json for selector "+e+".\nString being parsed is "+r+". Error is:\n",o),document.head.removeChild(n),o}}return document.head.removeChild(n),this._cache[e]=null==t?this._null_cache_value:t,t},s.ResponsiveUtils=function(){},s.ResponsiveUtils.SCREEN_RANGE={SM:"sm",MD:"md",LG:"lg",XL:"xl",XXL:"xxl"},s.ResponsiveUtils.FRAMEWORK_QUERY_KEY={SM_UP:"sm-up",MD_UP:"md-up",LG_UP:"lg-up",XL_UP:"xl-up",XXL_UP:"xxl-up",SM_ONLY:"sm-only",MD_ONLY:"md-only",LG_ONLY:"lg-only",XL_ONLY:"xl-only",MD_DOWN:"md-down",LG_DOWN:"lg-down",XL_DOWN:"xl-down",HIGH_RESOLUTION:"high-resolution"},s.ResponsiveUtils._RANGE={},s.ResponsiveUtils._RANGE[s.ResponsiveUtils.SCREEN_RANGE.SM]=0,s.ResponsiveUtils._RANGE[s.ResponsiveUtils.SCREEN_RANGE.MD]=1,s.ResponsiveUtils._RANGE[s.ResponsiveUtils.SCREEN_RANGE.LG]=2,s.ResponsiveUtils._RANGE[s.ResponsiveUtils.SCREEN_RANGE.XL]=3,s.ResponsiveUtils._RANGE[s.ResponsiveUtils.SCREEN_RANGE.XXL]=4,s.ResponsiveUtils._getMediaQueryFromClass=function(e){var t=document.getElementsByClassName(e).item(0);return null===t&&((t=document.createElement("meta")).className=e,document.head.appendChild(t)),window.getComputedStyle(t).getPropertyValue("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,"")},s.ResponsiveUtils.getFrameworkQuery=function(e){var t="oj-mq-"+e,n=s.ResponsiveUtils._getMediaQueryFromClass(t);return"null"==n?null:n},s.ResponsiveUtils.compare=function(e,t){var n=s.ResponsiveUtils._RANGE[e],o=s.ResponsiveUtils._RANGE[t];if(null==n)throw"size1 param "+e+" illegal, please use one of the screen size constants like oj.ResponsiveUtils.SCREEN_RANGE.MD";if(null==o)throw"size2 param "+t+" illegal, please use one of the screen size constants like oj.ResponsiveUtils.SCREEN_RANGE.MD";return n-o},s.StringUtils={},s.StringUtils._TRIM_ALL_RE=/^\s*|\s*$/g,s.StringUtils.isEmpty=function(e){return null===e||0===s.StringUtils.trim(e).length},s.StringUtils.isEmptyOrUndefined=function(e){return!(void 0!==e&&!s.StringUtils.isEmpty(e))},s.StringUtils.isString=function(e){return null!==e&&("string"==typeof e||e instanceof String)},s.StringUtils.trim=function(e){return s.StringUtils.isString(e)?e.replace(s.StringUtils._TRIM_ALL_RE,""):e},s.StringUtils.hashCode=function(e){var t=0;if(0===e.length)return t;for(var n=0;nn.length)&&(t=n.length),t-=e.length;var o=n.lastIndexOf(e,t);return-1!==o&&o===t}),s.CollectionUtils={},s.CollectionUtils.copyInto=function(e,t,n,o,r){return s.CollectionUtils._copyIntoImpl(e,t,n,o,r,0)},s.CollectionUtils.isPlainObject=function(e){if(null!==e&&"object"==typeof e)try{if(e.constructor&&e.constructor.prototype.hasOwnProperty("isPrototypeOf"))return!0}catch(e){}return!1},s.CollectionUtils._copyIntoImpl=function(e,t,n,o,r,i){var a,l,u;if(null==r&&(r=Number.MAX_VALUE),e&&t&&e!==t){u=Object.keys(t);for(var c=0;c2?o=Array.prototype.slice.call(arguments,1):2==arguments.length&&("object"==typeof(o=arguments[1])||o instanceof Array||(o=[o])),s.Translations.applyParameters(n,o)},s.Translations.getComponentTranslations=function(e){var t,n,o=s.Translations._getBundle()[e];if(null==o)return{};for(n in t={},o)o.hasOwnProperty(n)&&(t[n]=o[n]);return t},s.Translations._getResourceString=function(e){var t=e?e.split("."):[],n=s.Translations._getBundle(),o=t.length,r=0,i=t[r];for(s.Assert.assertObject(n);--o>0&&n;)n=n[i],i=t[++r];return n&&n[i]||null},s.Translations._format=function(e,t){var n,o,r=e.length,s=[],i=null,a=!1,l=!1,u=!1,c=!1;for(o=0;o0){var p=t[i.join("")];s.push(void 0===p?"null":p)}l=!1;break;case"[":l||(u?c=!0:u=!0);break;case"]":c?c=!1:u=!1;break;default:d=!0}d&&(l?","==g||" "==g?n=!0:n||i.push(g):c||s.push(g))}return s.join("")},s.Translations._getBundle=function(){var e=s.Translations._bundle;return e||(s.__isAmdLoaderPresent()?(s.Assert.assert(void 0!==t,"ojtranslations module must be defined"),t):{})},s.BusyState=function(e){this._description=e,this._addedWaitTs=s.BusyState._getTs(),this._id=this._addedWaitTs.toString(36)+"_"+Math.random().toString(36)},Object.defineProperties(s.BusyState.prototype,{id:{get:function(){return this._id},enumerable:!0},description:{get:function(){if(this._description)return this._description instanceof Function?this._description():this._description.toString()},enumerable:!0}}),s.BusyState.prototype.toString=function(){var e="Busy state: [description=",t=this.description;return null!==t&&(e+=t),e+=", elapsed="+(s.BusyState._getTs()-this._addedWaitTs)+"]"},s.BusyState._getTs=function(){return window.performance?window.performance.now():(new Date).getTime()},s.BusyContext=function(e){this.Init(e)},s.Object.createSubclass(s.BusyContext,s.Object,"oj.BusyContext"),s.BusyContext._defaultTimeout=Number.NaN,s.BusyContext.setDefaultTimeout=function(e){isNaN(e)||(s.BusyContext._defaultTimeout=e)},s.BusyContext.prototype.Init=function(e){s.BusyContext.superclass.Init.call(this),this._hostNode=e,this._statesMap=new Map,this._mediator={getMasterWhenReadyPromise:function(){return this._masterWhenReadyPromise||(this._masterWhenReadyPromise=new Promise(this._captureWhenReadyPromiseResolver.bind(this))),this._masterWhenReadyPromise},resolveMasterWhenReadyPromise:function(){this._masterWhenReadyPromiseResolver&&this._masterWhenReadyPromiseResolver(!0),this._masterWhenReadyPromise=null,this._masterWhenReadyPromiseResolver=null},getSlaveTimeoutPromise:function(e,t,n){var o,r=new Promise(function(e,r){o=window.setTimeout(function(){r(t())},n)});return this._slaveTimeoutPromiseTimers.push(o),Promise.race([e,r]).then(this._clearAllSlaveTimeouts.bind(this))},getNextTickPromise:function(){return this._nextTickPromise||(this._nextTickPromise=new Promise(function(e){window.setImmediate(function(){this._nextTickPromise=null,e(!0)}.bind(this))}.bind(this))),this._nextTickPromise},_clearAllSlaveTimeouts:function(){var e=this._slaveTimeoutPromiseTimers;this._slaveTimeoutPromiseTimers=[];for(var t=0;t> Busy states: %d",e.size);var t=s.BusyContext._values(e);t.length>0&&s.Logger.log(t.join("\n"))}},s.BusyContext._values=function(e){var t=[];return e.forEach(function(e){t.push(e)}),t},s.BusyContext.prototype.addBusyState=function(e){s.Logger.log("BusyContext.addBusyState: start scope='%s'",this._getDebugScope());var t=this._statesMap,n=new s.BusyState(e[s.BusyContext._DESCRIPTION]);return s.Logger.log(">> "+n),t.set(n.id,n),this._addBusyStateToParent(),s.Logger.log("BusyContext.addBusyState: end scope='%s'",this._getDebugScope()),this._removeBusyState.bind(this,n)},s.BusyContext.prototype.dump=function(e){s.Logger.info("BusyContext.dump: start scope='%s' %s",this._getDebugScope(),e||"");var t=this._statesMap;s.Logger.info(">> Busy states: %d",t.size);var n=s.BusyContext._values(t);n.length>0&&s.Logger.info(n.join("\n")),s.Logger.info("BusyContext.dump: start scope='%s' %s",this._getDebugScope(),e||"")},s.BusyContext.prototype.getBusyStates=function(){var e=this._statesMap;return s.BusyContext._values(e)},s.BusyContext.prototype.clear=function(){s.Logger.log("BusyContext.clear: start scope='%s'",this._getDebugScope());for(var e=this._statesMap,t=s.BusyContext._values(e),n=0;n0)t="#"+e.id;else{t=e.nodeName,e.hasAttribute("data-oj-context")&&(t+="[data-oj-context]");var n=e.getAttribute("class");n&&(t+="."+n.split(" ").join("."))}return t}return this._debugScope||(this._hostNode?this._debugScope=e(this._hostNode.parentElement)+" > "+e(this._hostNode):this._debugScope="page"),this._debugScope},s.BusyContext.prototype.toString=function(){var e="Busy Context: [scope=";return e+=this._getDebugScope(),e+=" states="+this._getCompoundDescription()+"]"},s.BusyContext._deliverThrottledUpdates=function(){s.ComponentBinding&&s.ComponentBinding.deliverChanges()},s.BusyContext._DESCRIPTION="description",s.BusyContext._OJ_RIP="__ojRip",s.BusyContext._BOOTSTRAP_MEDIATOR=new function(){var e,t,n;"undefined"!=typeof window&&(e=window.oj_whenReady),this.whenReady=function(){return t||(t=e?new Promise(function(e,t){n=e}):Promise.resolve(!0))},this.isReady=function(){return!e},this.notifyComplete=function(){n?window.setImmediate(function(){e=!1,n(!0),n=null}):e=!1}},s.Context=function(e){this.Init(e)},s.Object.createSubclass(s.Context,s.Object,"oj.Context"),s.Context.prototype.Init=function(e){s.Context.superclass.Init.call(this),this._node=e},s.Context.getContext=function(e){for(;e;){var t=e[s.Context._OJ_CONTEXT_INSTANCE];if(t)return t;if(e.hasAttribute(s.Context._OJ_CONTEXT_ATTRIBUTE))return t=new s.Context(e),Object.defineProperty(e,s.Context._OJ_CONTEXT_INSTANCE,{value:t}),t;e=s.Context.getParentElement(e)}return s.Context.getPageContext()},s.Context.getPageContext=function(){return s.Context._pageContext||(s.Context._pageContext=new s.Context),s.Context._pageContext},s.Context.prototype.getBusyContext=function(){return this._busyContext||(this._busyContext=new s.BusyContext(this._node)),this._busyContext},s.Context._OJ_CONTEXT_ATTRIBUTE="data-oj-context",s.Context._OJ_CONTEXT_INSTANCE="__ojContextInstance",s.Context._OJ_SURROGATE_ATTR="data-oj-surrogate-id",s.Context.getParentElement=function(e){if(e&&e.hasAttribute(s.Context._OJ_SURROGATE_ATTR)){var t=document.getElementById(e.getAttribute(s.Context._OJ_SURROGATE_ATTR));if(t)return t.parentElement}return e.parentElement},function(){s.__AttributeUtils={},s.__AttributeUtils.getExpressionInfo=function(e){var t={};if(e){var n=e.trim(),o=r.exec(n);(o=o?o[1]:null)||(t.downstreamOnly=!0,o=(o=i.exec(n))?o[1]:null),t.expr=o}return t},s.__AttributeUtils.attributeToPropertyName=function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})},s.__AttributeUtils.propertyNameToAttribute=function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})},s.__AttributeUtils.eventTypeToEventListenerProperty=function(e){return"on"+e.substr(0,1).toUpperCase()+e.substr(1)},s.__AttributeUtils.eventListenerPropertyToEventType=function(e){return/^on[A-Z]/.test(e)?e.substr(2,1).toLowerCase()+e.substr(3):null},s.__AttributeUtils.propertyNameToChangeEventType=function(e){return e+"Changed"},s.__AttributeUtils.changeEventTypeToPropertyName=function(e){return/Changed$/.test(e)?e.substr(0,e.length-7):null},s.__AttributeUtils.eventTriggerToEventType=function(e){return"oj"+e.substr(0,1).toUpperCase()+e.substr(1)},s.__AttributeUtils.eventTypeToEventTrigger=function(e){return/^oj[A-Z]/.test(e)?e.substr(2,1).toLowerCase()+e.substr(3):null},s.__AttributeUtils.coerceValue=function(r,s,i,a){if(!a)throw"Unable to parse "+s+"='"+i+"' for "+r.tagName+" with id "+r.id+" . This attribute only supports data bound values. Check the API doc for supported types";var l=a.toLowerCase(),u=n.test(i),c=o.test(i);if(e.test(l)&&u||t.test(l)&&c||"any"===l&&(u||c))try{return JSON.parse(i)}catch(e){throw"Unable to parse "+s+"='"+i+"' for "+r.tagName+" with id "+r.id+" to a JSON Object. Check the value for correct JSON syntax, e.g. double quoted strings. "+e}else if("boolean"===l){if(null==i||"true"===i||""===i||i.toLowerCase()===s)return!0;if("false"===i)return!1}else if("number"===l){if(!isNaN(i))return Number(i)}else{if(-1!==a.split("|").indexOf("string")||"any"===l)return i}throw"Unable to parse "+s+"='"+i+"' for "+r.tagName+" with id "+r.id+" to a "+a+"."};var e=/(^array)|(\|array)/,t=/(^object)|(\|object)/,n=/\s*\[[^]*\]\s*/,o=/\s*\{[^]*\}\s*/,r=/^(?:\{\{)([^]+)(?:\}\})$/,i=/^(?:\[\[)([^]+)(?:\]\])$/}(),"undefined"!=typeof window&&window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;--t>=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),s.__HtmlUtils=(a=function(e){for(var t=e.childNodes,n=t.length,o=0;o0;)g.appendChild(r.childNodes[0]);e.replaceChild(l,r)}else if("script"===s||"style"===s){for(l=document.createElement(s),u=0;u)","gi"),r=new RegExp(")","gi"),e=n.replace(o,"